home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload Trio 2
/
Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO
/
dir42
/
c7105.zip
/
SCRNFLDS.TPX
< prev
next >
Wrap
Text File
|
1994-03-02
|
43KB
|
589 lines
#!┌───────────────────────────┤Template Segment├───────────┬─────────────────┐
#!│ SrcnFlds.TPX │Version: 3007.105│
#!├───────────────────────────────┤Contents├───────────────┴─────────────────┤
#!│Structure Type Description │
#!│──────────────────── ───────── ─────────────────────────────────────────│
#!│ScreenSetupRoutines GROUP Pre-Edit (When field is selected) code │
#!│ScreenEditRoutines GROUP Post-Edit (When field is completed) code │
#!│FieldEditCode GROUP Writes code associated with "When field │
#!│ Is Completed" fields │
#!│PrimeRelationFields GROUP Primes relation key fields and return │
#!│ values before procedure call │
#!│FillRelationFields GROUP Refills relation key fields and return │
#!│ values after procedure call │
#!│ScreenEditLookupCode GROUP Generates code associated with Must-Be- │
#!│ In-File validations │
#!│CallScreenFieldEdit GROUP Generates code associated with non-Must- │
#!│ Be-In-File post-edit code │
#!│PrimeLookups GROUP Searches the dictionary for lookups or │
#!│ relations for a screen field │
#!│RangeCode GROUP Generates Range Validation Code │
#!│FieldLookupCode GROUP Generates Post-Edit Must-Be-In-File │
#!│ field validation │
#!│SetGenerationFlags GROUP Sets flags to generate CASE SELECTED() │
#!│ and CASE FIELD() structures in main │
#!│ body accept loops │
#!├───────────────────────────────┤Comments├─────────────────────────────────┤
#!│Version Comments │
#!│──────── ────────────────────────────────────────────────────────────────│
#!│3007.000 Release of CDD3 version 3007 templates │
#!│3007.100 Repaired ScreenSetupRoutines │
#!│3007.105 Repaired ScreenEditRoutines │
#!└──────────────────────────────────────────────────────────────────────────┘
#!
#GROUP(%ScreenSetupRoutines) #!Write Screen Field Setup Code
#!
#!┌────────────────────────────┤Template Group├────────────┬─────────────────┐
#!│ %ScreenSetupRoutines │Version: 3007.100│
#!├──────────────────────────────┤Description├─────────────┴─────────────────┤
#!│Purpose: Generate Pre-Edit (When Field is Selected) code for ENTRY │
#!│ fields. │
#!│Called From: Any procedure template that has a screen defined │
#!│Assumptions: That a %Screen is defined. │
#!│Inserts: %PrimeLookups │
#!│ %PrimeRelationFields │
#!│ %FillRelationFields │
#!│Symbols Set: None │
#!│Notes: This group generates all of the "OF xxx" cases for the │
#!│ CASE SELECTED() structure of an accept loop. │
#!├───────────────────────────────┤Comments├─────────────────────────────────┤
#!│Version Comments │
#!│──────── ────────────────────────────────────────────────────────────────│
#!│3007.000 Release of CDD3 version 3007 templates │
#!│3007.100 Repaired faulty assignment statement. Line read: │
#!│ %ScreenFieldUse <> %ScreenFieldSetupReturnValue, should be: │
#!│ %ScreenFieldUse = %ScreenFieldSetupReturnValue. │
#!└──────────────────────────────────────────────────────────────────────────┘
#!
#FOR(%ScreenField) #! FOR Each Screen Field
#IF(%ScreenFieldSetup) #! IF Setup Code Provided
OF %ScreenField #<! Setup %ScreenFieldUse field
#IF(%ScreenFieldSetupType='PROCEDURE') #! If Setup is Proc Call
#SET(%LookupFromField,%Null) #! Clear lookup field flag
#SET(%LookupFromFile,%Null) #! Clear lookup file flag
#FIX(%Field,%ScreenFieldUse) #! FIX to process FIELD
#FIX(%File,%FieldFile) #! FIX to process FIELD FILE
#IF(%NonStopSelect) #! IF proc has 'Save Mode'
IF ~NonStopSelect #<! IF Not in Save Mode
#ENDIF #! END (If proc has save mode)
#SET(%LocateField,%ScreenFieldSetupReturnValue) #! Find Return Value, is any
#INSERT(%PrimeLookups) #! Look For Relations
#IF(%LookupFromFile) #! IF a Related File Found
#FIX(%Relation,%LookupFromFile) #! FIX to process RELATION
#INSERT(%PrimeRelationFields) #! Prime Key Fields
#ELSE #! ELSE (No Related File)
#IF(%ScreenFieldSetupReturnValue) #! If Return Value provided
%ScreenFieldSetupReturnValue = %ScreenFieldUse #<! Prime Return Value
#ENDIF #! END (If Return Value...)
#ENDIF #! END (If No Relation)
SETKEYCODE(ShftEnter) #<! Set KeyCode for Selection
%ScreenFieldSetup #<! Call the Setup Proc
#IF(%LookupFromFile) #! IF a Related File Found
#INSERT(%FillRelationFields) #! Fill the key fields
#ELSE #! ELSE (No Related File)
#IF(%ScreenFieldSetupReturnValue) #! If Return Value provided
IF KEYCODE() <> EscKey #<! IF User didn't ESCAPE
%ScreenFieldUse = %ScreenFieldSetupReturnValue #<! Fill Screen Field
END #<! END (IF User didn't Escape)
#ENDIF #! END (IF Return Value)
#ENDIF #! END (If Related File...)
DISPLAY #<! DISPLAY new values
#IF(%NonStopSelect) #! IF proc has 'Save Mode'
END #<! END (If Not in 'Save Mode')
#ENDIF #! END (IF Proc has save mode)
#ELSE #! ELSE (Setup not Proc Call)
%ScreenFieldSetup #<! Write Setup Code
#ENDIF #! END (If Setup Proc Call)
#ENDIF #! END (If Setup Provided)
#ENDFOR #! END (For Each Screen Field)
#!***************************************************************************
#GROUP(%ScreenEditRoutines) #!Write Screen Field Edit Code
#!
#!┌────────────────────────────┤Template Group├────────────┬─────────────────┐
#!│ %ScreenEditRoutines │Version: 3007.000│
#!├──────────────────────────────┤Description├─────────────┴─────────────────┤
#!│Purpose: Generate Post-Edit (When Field is Completed) code for ENTRY │
#!│ fields. │
#!│Called From: Any procedure template that has a screen defined │
#!│Assumptions: That a %Screen is defined, and that %ScreenField is fixed │
#!│ to a valid screen field. │
#!│Inserts: %RangeCode │
#!│ %FieldEditCode │
#!│ %FieldLookupCode │
#!│Symbols Set: None │
#!│Notes: This group generates one "OF xxx" case for the CASE FIELD() │
#!│ structure of an accept loop. │
#!├───────────────────────────────┤Comments├─────────────────────────────────┤
#!│Version Comments │
#!│──────── ────────────────────────────────────────────────────────────────│
#!│3007.000 Release of CDD3 version 3007 templates │
#!│3007.105 Re-Fixed field if the FIX to File failed. This was causing │
#!│ problems in the Range Code for Non-File related fields not │
#!│ working. │
#!└──────────────────────────────────────────────────────────────────────────┘
#!
#IF(%ScreenFieldType='ENTRY') #! IF an ENTRY field
#FIX(%Field,%ScreenFieldUse) #! FIX to process FIELD
#FIX(%File,%FieldFile) #! FIX to process FIELD FILE
#IF(NOT %File) #! IF File NOT set
#FIX(%Field,%ScreenFieldUse) #! RE-FIX to process FIELD
#ENDIF #! END (IF File NOT set)
#SET(%GenScreenFieldEdit,'TRUE') #! Default to Gen Edit Code
#SET(%GenRangeCode,%Null) #! Default to NOT gen range code
#IF(%FieldRangeLow) #! IF a Low range on field
#SET(%GenRangeCode,'TRUE') #! Flag to gen range code
#ELSIF(%FieldRangeHigh) #! IF a High range on field
#SET(%GenRangeCode,'TRUE') #! Flag to gen range code
#ELSIF(%FieldLookup) #! if Must Be In File
#ELSIF(%ScreenFieldEdit) #! or Edit Code provided
#ELSE #! otherwise
#SET(%GenScreenFieldEdit,%Null) #! Flag to NOT gen code
#ENDIF #! END (If FieldRangeLow...)
#IF(%GenScreenFieldEdit) #! IF we have to gen edit code
#SET(%LookupFromField,%Null) #! Clear lookup field flag
#SET(%LookupFromFile,%Null) #! Clear lookup file flag
OF %ScreenField #<! Completed %ScreenFieldUse field
#IF(%GenRangeCode) #! IF Range Code Needed
#INSERT(%RangeCode) #! Generate Range Code
#ENDIF #! END (If range code needed)
#IF(%ScreenFieldEdit) #! IF Edit Code Provided
#INSERT(%FieldEditCode) #! Generate Edit Code
#ENDIF #! END (If Edit Code...)
#IF(%FieldLookup) #! IF Must Be In File
#INSERT(%FieldLookupCode) #! Generate Validation Code
#ENDIF #! END (If Must Be...)
#ENDIF #! END (If gen Edit Code)
#ELSE #! ELSE (If not entry field)
#IF(%ScreenFieldEdit) #! If Edit Code Provided
OF %ScreenField #<! Completed %ScreenFieldUse field
%ScreenFieldEdit #<! Generate Edit Code
DISPLAY #<! DISPLAY new value
#ENDIF #! END (If Edit Code...)
#ENDIF #! END (If Entry Field)
#!***************************************************************************
#GROUP(%FieldEditCode) #!Proc/Source Code Generation
#!
#!┌────────────────────────────┤Template Group├────────────┬─────────────────┐
#!│ %FieldEditCode │Version: 3007.000│
#!├──────────────────────────────┤Description├─────────────┴─────────────────┤
#!│Purpose: Writes code associated with "When Field Is Completed" │
#!│ Procedure Calls │
#!│Called From: %ScreenEditRoutines #GROUP │
#!│Assumptions: That a %Screen is defined, and that %ScreenField is fixed │
#!│ to a valid screen field. │
#!│Inserts: %PrimeLookups │
#!│ %ScreenEditLookupCode │
#!│ %CallScreenFieldEdit │
#!│Symbols Set: None │
#!│Notes: None │
#!├───────────────────────────────┤Comments├─────────────────────────────────┤
#!│Version Comments │
#!│──────── ────────────────────────────────────────────────────────────────│
#!│3007.000 Release of CDD3 version 3007 templates │
#!└──────────────────────────────────────────────────────────────────────────┘
#!
#IF(ScreenFieldEditType='PROCEDURE') #! IF Edit Code is Proc Name
#SET(%LocateField,%ScreenFieldEditReturnValue) #! Prime Locate Field
#INSERT(%PrimeLookups) #! Look For Relations
#IF(%LookupFromFile) #! IF a Related File Found
#<! Field Related to %LookupFromField
#FIX(%Relation,%LookupFromFile) #! FIX to process RELATION
#INSERT(%ScreenEditLookupCode) #! and Call the Lookup Code
#ELSE #! ELSE (If no Relation)
#<! No Relation Found
#IF(%ScreenFieldEditHotKey) #! If a Hot Key specified
#<! %ScreenFieldEditHotKey calls PROC
IF KEYCODE() = %ScreenFieldEditHotKey #<! IF Hotkey completed field
#INSERT(%CallScreenFieldEdit) #! write non-lookup edit code
DISPLAY #<! Display New Values
END #<! END (IF hotkey...)
#ELSE #! ELSE (No Hotkey provided)
#IF(%NonStopSelect) #! IF In Proc with field validation
IF ~NonStopSelect #<! IF NOT in non-stop select
#INSERT(%CallScreenFieldEdit) #! write non-lookup edit code
DISPLAY #<! Display New Values
END #<! END (If NOT Non-Stop...)
#ELSE #! ELSE (Not in Non-Stop Proc)
#INSERT(%CallScreenFieldEdit) #! write non-lookup edit code
DISPLAY #<! Display New Values
#ENDIF #! END (If Non-Stop Select)
#ENDIF #! END (If Hot Key Defined)
#ENDIF #! END (If Related File Found)
#ELSE #! ELSE (Not a Proc Call)
%ScreenFieldEdit #<! Write Source Code
#ENDIF #! END (If Edit Code...)
#!***************************************************************************
#GROUP(%PrimeRelationFields) #!Prime all Related Fields
#!
#!┌────────────────────────────┤Template Group├────────────┬─────────────────┐
#!│ %PrimeRelationFields │Version: 3007.000│
#!├──────────────────────────────┤Description├─────────────┴─────────────────┤
#!│Purpose: Fills relation and return value fields before Pre and Post │
#!│ Edit Procedure Calls. │
#!│Called From: %ScreenEditLookupCode │
#!│ %ScreenSetupRoutines │
#!│Assumptions: That a %Relation exists between the screen field file and │
#!│ the return value, or Must-Be-in-File is set for the screen │
#!│ entry field. In either case, %Relation is assumed to be │
#!│ #FIXed. │
#!│ That %LocateField is set to EITHER Edit or Setup Return │
#!│ value │
#!│Inserts: None │
#!│Symbols Set: None │
#!│Notes: None │
#!├───────────────────────────────┤Comments├─────────────────────────────────┤
#!│Version Comments │
#!│──────── ────────────────────────────────────────────────────────────────│
#!│3007.000 Release of CDD3 version 3007 templates │
#!└──────────────────────────────────────────────────────────────────────────┘
#!
#SET(%AssignReturnValue,%LocateField) #! Default Return Value Assign
#FOR(%RelationKeyField) #! FOR fields in Relation Key
%RelationKeyField = %RelationKeyFieldLink #<! Prime Related Field
#IF(UPPER(%RelationKeyFieldLink) = UPPER(%ScreenFieldUse)) #! IF Link was written
#IF(UPPER(%RelationKeyField) = UPPER(%LocateField)) #! IF Linked to Return Value
#SET(%AssignReturnValue,%Null) #! Clear Return Value Flag
#ENDIF #! END (IF Linked to...)
#BREAK #! Quit Processing
#ENDIF #! END (If Link written)
#ENDFOR #! END (For RelationKeyField)
#IF(%AssignReturnValue) #! IF Assignment needed
%LocateField = %ScreenFieldUse #<! Fill the Return Value
#ENDIF #! END (If Assignment Needed)
#!***************************************************************************
#GROUP(%FillRelationFields) #!Fill all relation Fields
#!
#!┌────────────────────────────┤Template Group├────────────┬─────────────────┐
#!│ %PrimeRelationFields │Version: 3007.000│
#!├──────────────────────────────┤Description├─────────────┴─────────────────┤
#!│Purpose: Fills relation and screen field after Pre and Post Edit │
#!│ Procedure Calls. │
#!│Called From: %ScreenEditLookupCode │
#!│ %ScreenSetupRoutines │
#!│Assumptions: That a %Relation exists between the screen field file and │
#!│ the return value, or Must-Be-in-File is set for the screen │
#!│ entry field. In either case, %Relation is assumed to be │
#!│ #FIXed. │
#!│ That %LocateField is set to EITHER Edit or Setup Return │
#!│ value │
#!│Inserts: None │
#!│Symbols Set: None │
#!│Notes: None │
#!├───────────────────────────────┤Comments├─────────────────────────────────┤
#!│Version Comments │
#!│──────── ────────────────────────────────────────────────────────────────│
#!│3007.000 Release of CDD3 version 3007 templates │
#!└──────────────────────────────────────────────────────────────────────────┘
#!
IF KEYCODE()<>EscKey #<! IF User didn't ESCAPE
#SET(%AssignReturnValue,%LocateField) #! Default Return Value Assign
#FOR(%RelationKeyField) #! FOR fields in Relation Key
%RelationKeyFieldLink = %RelationKeyField #<! Fill Related Field
#IF(UPPER(%RelationKeyFieldLink) = UPPER(%ScreenFieldUse)) #! IF Link was written
#IF(UPPER(%RelationKeyField) = UPPER(%LocateField)) #! IF Linked to Return Value
#SET(%AssignReturnValue,%Null) #! Clear Return Value Flag
#ENDIF #! END (IF Linked to...)
#BREAK #! Quit Processing
#ENDIF #! END (If Link written)
#ENDFOR #! END (For RelationKeyField)
#IF(%AssignReturnValue) #! IF Assignment needed
%ScreenFieldUse = %LocateField #<! Fill from Return Value
#ENDIF #! END (If Assignment Needed)
END #<! END (If User didn't ESCAPE)
#!***************************************************************************
#GROUP(%ScreenEditLookupCode) #!Generate Code for Lookups
#!
#!┌────────────────────────────┤Template Group├────────────┬─────────────────┐
#!│ %ScreenEditLookupCode │Version: 3007.000│
#!├──────────────────────────────┤Description├─────────────┴─────────────────┤
#!│Purpose: Generates code associated with Must-Be-In-File post-edit │
#!│ code │
#!│Called From: %FieldEditCode │
#!│Assumptions: None │
#!│Inserts: None │
#!│Symbols Set: None │
#!│Notes: None │
#!├───────────────────────────────┤Comments├─────────────────────────────────┤
#!│Version Comments │
#!│──────── ────────────────────────────────────────────────────────────────│
#!│3007.000 Release of CDD3 version 3007 templates │
#!└──────────────────────────────────────────────────────────────────────────┘
#!
#IF(%FieldLookup) #! IF Must Be In File
#<! Must be in %FieldLookup
#INSERT(%PrimeRelationFields) #! Prime Key Fields
GET(%Relation,%RelationKey) #<! Look for parent record
#IF(%ScreenFieldEditHotKey) #! IF a Hot Key is Defined
#<! %ScreenFieldEditHotKey calls PROC
#IF(%ScreenFieldRequired) #! IF Screen Field is required
IF ERRORCODE() OR KEYCODE() = %ScreenFieldEditHotKey#<! If Not Found or Hotkey
#ELSE #! ELSE (IF NOT Screen Field...)
IF (%ScreenFieldUse AND ERRORCODE()) OR KEYCODE() = %ScreenFieldEditHotKey#<! If Not Found or Hotkey
#ENDIF #! END (IF Screen Field...)
SETKEYCODE(ShftEnter) #<! Set Keycode for Select
%ScreenFieldEdit #<! Call the Select Proc
#INSERT(%FillRelationFields) #! Fill the key fields
SELECT(%ScreenField) #<! and re-select the field
END #<! END (If No Parent or Hotkey)
#ELSE #! ELSE (No Hotkey)
IF ERRORCODE() #<! If Not Found
SETKEYCODE(ShftEnter) #<! Set Keycode for Select
%ScreenFieldEdit #<! Call the Select Proc
#INSERT(%FillRelationFields) #! Fill the key fields
SELECT(%ScreenField) #<! and re-select the field
END #<! END (If Not Found)
#ENDIF #! END (If HotKey)
#ELSE #! ELSE (Not Must Be In File)
#<! Must Be In File NOT SET
#IF(%ScreenFieldEditHotKey) #! IF a Hot Key is Defined
#<! %ScreenFieldEditHotKey calls PROC
IF KEYCODE() = %ScreenFieldEditHotKey #<! IF HotKey completed field
#INSERT(%PrimeRelationFields) #! Prime Key Fields
SETKEYCODE(ShftEnter) #<! Set Keycode for Select
%ScreenFieldEdit #<! Call the Select Proc
#INSERT(%FillRelationFields) #! Fill the key fields
SELECT(%ScreenField) #<! and re-select the field
END #<! END (If HotKey Pressed)
#ELSE #! ELSE (No HotKey)
#IF(%NonStopSelect) #! IF In Proc with field validation
IF ~NonStopSelect #<! IF NOT in non-stop select
#INSERT(%PrimeRelationFields) #! Prime Key Fields
SETKEYCODE(ShftEnter) #<! Set Keycode for Select
%ScreenFieldEdit #<! Call the Select Proc
#INSERT(%FillRelationFields) #! Fill the key fields
END #<! END (If NOT Non-Stop...)
#ELSE #! ELSE (Not in Non-Stop Proc)
#INSERT(%PrimeRelationFields) #! Prime Key Fields
SETKEYCODE(ShftEnter) #<! Set Keycode for Select
%ScreenFieldEdit #<! Call the Select Proc
#INSERT(%FillRelationFields) #! Fill the key fields
#ENDIF #! END (If Non-Stop Select)
#ENDIF #! END (If Hot Key Defined)
#ENDIF #! END (If Field Lookup)
#!***************************************************************************
#GROUP(%CallScreenFieldEdit) #!Call code for non-lookups
#!
#!┌────────────────────────────┤Template Group├────────────┬─────────────────┐
#!│ %CallScreenFieldEdit │Version: 3007.000│
#!├──────────────────────────────┤Description├─────────────┴─────────────────┤
#!│Purpose: Generates code associated with non-Must-Be-In-File │
#!│ post-edit code │
#!│Called From: %FieldEditCode │
#!│Assumptions: None │
#!│Inserts: None │
#!│Symbols Set: None │
#!│Notes: None │
#!├───────────────────────────────┤Comments├─────────────────────────────────┤
#!│Version Comments │
#!│──────── ────────────────────────────────────────────────────────────────│
#!│3007.000 Release of CDD3 version 3007 templates │
#!└──────────────────────────────────────────────────────────────────────────┘
#!
#IF(%ScreenFieldEditReturnValue) #! IF a Return Value provided
%ScreenFieldEditReturnValue = %ScreenFieldUse #<! Prime Return Value
#ENDIF #! END (If a Return Value...)
SETKEYCODE(ShftEnter) #<! Set KeyCode for Selection
%ScreenFieldEdit #<! Call the Edit Proc
#IF(%ScreenFieldEditReturnValue) #! IF a Return Value provided
IF KEYCODE() <> EscKey #<! IF User didn't ESCAPE
%ScreenFieldUse = %ScreenFieldEditReturnValue #<! Fill the Return Value
END #<! END (If User didn't...)
#ENDIF #! END (If a Return Value...)
#!***************************************************************************
#GROUP(%PrimeLookups) #!Prime Lookup Values
#!
#!┌────────────────────────────┤Template Group├────────────┬─────────────────┐
#!│ %PrimeLookups │Version: 3007.000│
#!├──────────────────────────────┤Description├─────────────┴─────────────────┤
#!│Purpose: Searches the dictionary for lookups or relations for a │
#!│ screen field │
#!│Called From: %ScreenSetupRoutines │
#!│ %FieldEditCode │
#!│Assumptions: None │
#!│Inserts: None │
#!│Symbols Set: None │
#!│Notes: None │
#!├───────────────────────────────┤Comments├─────────────────────────────────┤
#!│Version Comments │
#!│──────── ────────────────────────────────────────────────────────────────│
#!│3007.000 Release of CDD3 version 3007 templates │
#!└──────────────────────────────────────────────────────────────────────────┘
#!
#IF(%FieldLookup) #! IF Must Be In File
#FIX(%Relation,%FieldLookup) #! FIX the Relation to %File
#IF(%Relation) #! IF the FIX was successful
#IF(%RelationType='MANY:1') #! IF the Relation is Many:1
#FOR(%RelationKeyField) #! Cycle through Key Fields
#IF(%RelationKeyFieldLink) #! If a Linked Field Exists
#IF(UPPER(%RelationKeyFieldLink)=UPPER(%ScreenFieldUse)) #!If Linked Field=Screen Field
#SET(%LookupFromFile,%Relation) #! Flag RelatedFile
#SET(%LookupFromField,%RelationKeyField) #!Flag Related Field
#BREAK #! AND quit Processing
#ENDIF #! END (IF Linked Field =...)
#ENDIF #! END (IF Linked Field Exists...)
#ENDFOR #! END (FOR Key Fields...)
#ENDIF #! END (If Many:1...)
#ENDIF #! END (If Valid Relation)
#ELSIF(%LocateField) #! ELSE (IF LocateField provided)
#FOR(%File) #! Search through each file
#FIX(%Field,%LocateField) #! Attempt to fix field
#IF(%Field) #! IF FIX successful
#SET(%LookupFromFile,%File) #! Save Current File
#FIX(%Field,%ScreenFieldUse) #! FIX back to screen field
#FIX(%File,%FieldFile) #! FIX back to file
#FIX(%Relation,%LookupFromFile) #! FIX relation to saved value
#SET(%LookupFromFile,%Null) #! Clear Flag
#IF(%Relation) #! If return value field file
#IF(%RelationType='MANY:1') #! IF the Relation is Many:1
#FOR(%RelationKeyField) #! Cycle through Key Fields
#IF(UPPER(%RelationKeyFieldLink)=UPPER(%ScreenFieldUse)) #!If Linked Field=Screen Field
#IF(UPPER(%RelationKeyField)=UPPER(%LocateField))#! If Linked Field = Locate Field
#SET(%LookupFromFile,%Relation) #! Flag RelatedFile
#SET(%LookupFromField,%LocateField) #!Flag Related Field
#BREAK #! AND quit Processing
#ENDIF #! END (IF Linked Field =...)
#ENDIF #! END (IF Linked Field Exists...)
#ENDFOR #! END (FOR Key Fields...)
#ENDIF #! END (If Many:1...)
#ENDIF #! END (If Valid Relation)
#BREAK #! QUIT Processing Files
#ENDIF #! END (IF FIX...)
#ENDFOR #! END (Searching Files)
#FIX(%Field,%ScreenFieldUse) #! FIX back to screen field
#FIX(%File,%FieldFile) #! FIX back to file
#ENDIF #! END (If Must Be...)
#!***************************************************************************
#GROUP(%RangeCode) #!Value Range Validation
#!
#!┌────────────────────────────┤Template Group├────────────┬─────────────────┐
#!│ %RangeCode │Version: 3007.000│
#!├──────────────────────────────┤Description├─────────────┴─────────────────┤
#!│Purpose: Generates Range Validation Code │
#!│Called From: %ScreenEditRoutines │
#!│Assumptions: None │
#!│Inserts: None │
#!│Symbols Set: None │
#!│Notes: None │
#!├───────────────────────────────┤Comments├─────────────────────────────────┤
#!│Version Comments │
#!│──────── ────────────────────────────────────────────────────────────────│
#!│3007.000 Release of CDD3 version 3007 templates │
#!└──────────────────────────────────────────────────────────────────────────┘
#!
IF KEYCODE() <> EscKey #<! IF user didn't escape
#IF(%FieldRangeLow = %NULL) #! If No Low Value provided
IF %ScreenFieldUse > %FieldRangeHigh #<! IF field too high
#INSERT(%FieldValueTooHigh) #! Alert the User
#ELSIF(%FieldRangeHigh = %NULL) #! ELSE (No High Value provided)
IF %ScreenFieldUse < %FieldRangeLow #<! IF field too low
#INSERT(%FieldValueTooLow) #! Alert the User
#ELSE #! ELSE (High and Low provided)
IF ~INRANGE(%ScreenFieldUse,%FieldRangeLow,%FieldRangeHigh)#<! IF field out of range
#INSERT(%FieldValueOutOfRange) #! Alert the User
#ENDIF #! END (If FieldRangeLow...)
SELECT(%ScreenField) #<! Select the same field
CYCLE #<! and repeat the process
END #<! END (If bad range value)
END #<! END (If user didn't esc)
#!***************************************************************************
#GROUP(%FieldLookupCode) #!Relation Validation Code
#!
#!┌────────────────────────────┤Template Group├────────────┬─────────────────┐
#!│ %FieldLookupCode │Version: 3007.000│
#!├──────────────────────────────┤Description├─────────────┴─────────────────┤
#!│Purpose: generates Post-Edit Must-Be-In-File field validation │
#!│Called From: %ScreenEditRoutines │
#!│Assumptions: None │
#!│Inserts: None │
#!│Symbols Set: None │
#!│Notes: None │
#!├───────────────────────────────┤Comments├─────────────────────────────────┤
#!│Version Comments │
#!│──────── ────────────────────────────────────────────────────────────────│
#!│3007.000 Release of CDD3 version 3007 templates │
#!└──────────────────────────────────────────────────────────────────────────┘
#!
#FIX(%Field,%ScreenFieldUse) #! FIX to process Field
#FIX(%File,%FieldFile) #! FIX to process File
#FIX(%Relation,%FieldLookup) #! FIX to process Relation
#IF(%RelationType = 'MANY:1') #! IF a MANY:1 Relation
IF KEYCODE() <> EscKey #<! IF user didn't escape
#FOR(%RelationKeyField) #! FOR each relation key field
%RelationKeyField = %RelationKeyFieldLink #<! Assign linking field value
#ENDFOR #! END (FOR each relation...)
GET(%Relation,%RelationKey) #<! Lookup record
IF ERRORCODE() #<! If GET did not succeed ?
#FIX(%File,%FieldLookup) #! FIX to process Relation as File
CLEAR(%FilePre:Record) #<! Clear record if unsuccessful
#INSERT(%ParentRecordNotFound) #! Alert the User
SELECT(%ScreenField) #<! Reselect the screen field
ELSE #<! Else IF Errorcode
DISPLAY #<! Update screen display
END #<! End IF Errorcode
END #<! Not EscKey
#ENDIF #! END (IF Many:1)
#!***************************************************************************
#GROUP(%SetGenerationFlags)
#!
#!┌────────────────────────────┤Template Group├────────────┬─────────────────┐
#!│ %SetGenerationFlags │Version: 3007.000│
#!├──────────────────────────────┤Description├─────────────┴─────────────────┤
#!│Purpose: Sets flags to generate CASE SELECTED() and CASE FIELD() │
#!│ structures in main-body accept loops │
#!│Called From: Any procedure template that has a screen defined │
#!│Assumptions: None │
#!│Inserts: None │
#!│Symbols Set: None │
#!│Notes: None │
#!├───────────────────────────────┤Comments├─────────────────────────────────┤
#!│Version Comments │
#!│──────── ────────────────────────────────────────────────────────────────│
#!│3007.000 Release of CDD3 version 3007 templates │
#!└──────────────────────────────────────────────────────────────────────────┘
#!
#SET(%SelectedCaseRequired,%Null) #!
#SET(%FieldCaseRequired,%Null) #!
#SET(%HotKeyCaseRequired,%Null)
#IF(%Screen) #!
#FOR(%ScreenField) #!
#SET(%SearchButton,(UPPER(%ScreenField) & '?'))#!
#IF(%ScreenFieldSetup) #!
#SET(%SelectedCaseRequired,'TRUE') #!
#ELSIF(INSTRING(%SearchButton,%SmartSelectedButtons,1,1))#!
#SET(%SelectedCaseRequired,'TRUE') #!
#ENDIF #!
#IF(NOT %FieldCaseRequired) #!
#IF(%ScreenFieldEdit) #!
#SET(%FieldCaseRequired,'TRUE') #!
#ELSIF(INSTRING(%SearchButton,%SmartFieldButtons,1,1))#!
#SET(%FieldCaseRequired,'TRUE') #!
#ELSIF(%FieldRangeLow) #!
#SET(%FieldCaseRequired,'TRUE') #!
#ELSIF(%FieldRangeHigh) #!
#SET(%FieldCaseRequired,'TRUE') #!
#ELSIF(%FieldLookup) #!
#SET(%FieldCaseRequired,'TRUE') #!
#ENDIF #!
#ENDIF #!
#IF(%FieldCaseRequired AND %SelectedCaseRequired)
#BREAK #!
#ENDIF #!
#ENDFOR #!
#ENDIF #!
#IF(NOT %FieldCaseRequired) #!
#IF(%PullDown) #!
#FOR(%PulldownField) #! add all procedure or
#IF(%PulldownFieldType = 'PROCEDURE') #! source code calls
#SET(%FieldCaseRequired,'TRUE') #!
#BREAK #!
#ENDIF #!
#ENDFOR #!
#ENDIF #!
#ENDIF #!
#FOR(%HotKey)
#SET(%HotKeyCaseRequired,'TRUE')
#BREAK
#ENDFOR
#!***************************************************************************
#CHAIN('BrwsGrps.TPX')